package kwic;

import java.util.ArrayList;
import java.util.List;

public class TestKwic
{

  private Document doc;
  private List<String> tests;
  
  /**
   * @param args
   */
  public static void main(String[] args)
  {
    TestDocument t = new TestDocument();
    t.addTest("empty.txt");
    t.addTest("empty_line.txt");
    t.addTest("one_line.txt");
    t.addTest("capitals.txt");
    t.addTest("words.txt");
    t.addTest("one_or_more_chars.txt");
    t.addTest("few_identical_words.txt");
    t.runTests();
  }
  
  public TestKwic()
  {
    tests = new ArrayList<String>();
  }
  
  public void addTest(String filename)
  {
    tests.add(filename);
  }
  
  public void runTests()
  {
    for(String t : tests)
    {
      runTest(t);
      System.out.println("--- ---");
    }
  }
  
  public void runTest(String filename)
  {
    doc = new Document();
    System.out.println("Start of test: " + filename);
    doc.read(filename);
    System.out.println("read");
    doc.write();
    doc.shift();
    System.out.println("shift");
    doc.write();
    doc.sort();
    System.out.println("sort");
    doc.write();
    System.out.println("End of test " + filename);
  }

}
